﻿using RayD.Core;
using System;
using System.IO;

namespace RayD.WebApi
{
    /// <summary>
    /// Grid++Report6 报表通用封装
    /// </summary>
    public static class GridReport
    {
        /// <summary>
        /// 获取报表模板Json
        /// </summary>
        /// <param name="grf_name">报表名称</param>
        /// <returns></returns>
        public static string GetTemplateJson(string grf_name)
        {
            string grf_path = Path.Combine(Environment.CurrentDirectory, $"Report{Path.DirectorySeparatorChar}grf{Path.DirectorySeparatorChar}{grf_name}.grf");
            if (DirFileHelper.IsExistFile(grf_path))
            {
                return System.IO.File.ReadAllText(grf_path);
            }
            else
            {
                return string.Empty;
            }
        }
    }

}
